package com.hzc.springchan.strategy.restrequest.impl;

import com.hzc.springchan.bean.request.Request;
import com.hzc.springchan.config.resthelp.RequestConcurrent;
import com.hzc.springchan.constant.System;
import com.hzc.springchan.strategy.restrequest.IRestRequestStrategy;
import org.aspectj.lang.JoinPoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Post rest请求参数封装策略类
 * @author chen990627
 * @date 2022/10/18
 */
@Service(System.RestRequestStrategy.POST)
public class PostRestRequestStrategy implements IRestRequestStrategy {

    @Autowired
    private RequestConcurrent requestConcurrent;

    @Override
    public void restRequest(JoinPoint point) {

        Object[] arguments = point.getArgs();
        Request request = (Request) arguments[0];
        requestConcurrent.putCurrentRequest(request);
    }
}
